/*
 * To change this license header, choose License Headers in Project Properties. To change this
 * template file, choose Tools | Templates and open the template in the editor.
 */
package chalmers.game.subterranean.model.world.squares.blocks;

import chalmers.game.subterranean.util.Resource;
import chalmers.game.subterranean.util.BlockType;

/**
 * 
 * @author TH
 */
public abstract class Block implements ISquareType {

  public abstract Resource getResource();

  protected float durability = 1.0f;

  @Override
  public boolean handlePressAgainst() {
    return false;
  }

  @Override
  public abstract BlockType handleGetType();

  @Override
  public Resource handleDig(double damage) {
    durability -= damage;
    if (durability <= 0) {
      return getResource();
    }
    return null;
  }

  @Override
  public float handleGetDurability() {
    return durability;
  }

  @Override
  public void handleAction() {}

}
